import $ from 'jquery';
export function sayHello() {

//头部显示隐藏

$(".subnav-model-classification .nav-class-left>a").mouseover(function() {
    var e = $(this).index()
      , a = $(this);
    a.addClass("active").siblings().removeClass("active"),
    0 == a.parents(".subnav-model-classification").find(".list-class-content>div").eq(e).length ? a.parents(".subnav-model-classification").find(".list-class-content>div").removeClass("active") : a.parents(".subnav-model-classification").find(".list-class-content>div").eq(e).addClass("active").siblings().removeClass("active")
}),

//搜索
$(window).scroll(function() {
    $(".newwww-search-content").hasClass("newwww-search-show") && setTimeout(function() {
        $(".mask-www-input-search").css("display", "none"),
        $(".newwww-search-content").removeClass("newwww-search-show"),
        $(".js-search-normal").blur()
    }, 100)
})

$(".js-search-normal").on("focus", function() {
    $(".newww-related-search .lately-search").hide();
    $(this).parents(".newwww-search-content").addClass("newwww-search-show"),
    $(".mask-www-input-search").fadeIn(50),
    $(this).parents(".model-search-position").addClass("newwww-search-show-list"),
    $(this).addClass("newww-related-search-active")
       
})

$(".js_close_btn_search").on("click", function() {
    $(".newwww-search-content").removeClass("newwww-search-show"),
    $(".mask-www-input-search").fadeOut(),
    $(".head-public-search").fadeOut(function() {
        $(this).remove()
    })
})

//吸顶
$(function() {
    var t, e = null, r = 1, n = !0, o = !0, a = $(window).height(), i = $(document).height(), s = $(window).scrollTop(), l = null, c = $(".interest-occupying").offset().top, d = {}, u = $(".www-footer").height() + 1500, p = !1, h = 0, f = Math.floor(2 * Math.random()), v = function() {
        for (var t = Math.floor(6 * Math.random()) + 5, e = [], a = [], i = 0; i < t; i++) {
            var n = Math.floor(15 * Math.random()) + 1;
            -1 == e.indexOf(n) ? e.push(n) : i--
        }
        for (var s = 0; s < t; s++) {
            var r = Math.floor(15 * Math.random()) + 16;
            -1 == a.indexOf(r) ? a.push(r) : s--
        }
        var o = Math.round(7 * t / 10)
          , l = Math.round(3 * t / 10)
          , c = e.slice(0, o)
          , d = a.slice(0, l);
        return c.concat(d)
    }();
    $(window).scroll(function() {
        s = $(this).scrollTop(),
        i = $(document).height(),
        a = $(this).height(),
        c < s ? ($(".news-index-other").css({
            opacity: 1,
            visibility: "visible",
            "z-index": 11
        }),
        $(".interest-occupying .flex-top-interest").addClass("fixed-interest"),
        $(".new-nav-page").addClass("other-scroll-white head-fixed"),$(".new-nav-page .nav-left").attr("data-custom", "example")) : ($(".news-index-other").removeAttr("style"),
      
        $(".interest-occupying .flex-top-interest").removeClass("fixed-interest"),
        $(".new-nav-page").removeClass("other-scroll-white head-fixed"),$(".new-nav-page .nav-left").removeAttr("data-custom")),
        0 != $(".list-popup-favorite").length && ($(".list-popup-favorite").fadeOut(function() {
            $(this).remove()
        }),
        $(".select-mask-collect").removeClass("select-mask-collect"),
        $(".model-contrast").find("a,div").removeAttr("style")),
        0 != $(".new-edition-home .show-active").length && $(".show-active").removeClass("show-active"),
        i - u - 500 <= s + a && n && o,
        h < s && 150 <= s && $(".modalOpenWidth").hasClass("is-show") ? $(".modalOpenWidth").addClass("modalOpenShow") : $(".modalOpenWidth").removeClass("modalOpenShow"),
        h = s
    })
})

//下拉菜单
$(document).on("click", ".model-search-position .home-search-category,.interest-content .interest-search-category", function(t) {
    $(this).toggleClass("show-active"),
    $(this).hasClass("home-search-category") ? $(".interest-content .interest-search-category").removeClass("show-active") : $(".model-search-position .home-search-category").removeClass("show-active"),
    $(document).one("click", function() {
        $(".model-search-position .home-search-category,.interest-content .interest-search-category").removeClass("show-active")
    }),
    "li" != t.target.localName && t.stopPropagation()
})

//吸顶搜索框
$(".js-nav-search").on("focus", function() {
    if ($(this).parents(".js-new-search-box").addClass("active").find(".js-new-search-input ").css("background", "#F8F8F8"),
    $(".scroll-white head-fixed .nav-right").addClass("search-active-right"),
    $(".new-nav-page .left-nav-list,.new-nav-page .right-nav-item").hide(),
    $(".new-nav-page .login-nav-item").show(),
    $(".js-new-related-search").show(),
    $(".new-nav-search-mask").fadeIn(),
    0 == s && (setTimeout(function() {
        l()
    }, 100),
    s++),
    $.cookie("www_search_history") && "null" != $.cookie("www_search_history")) {
        var e = JSON.parse($.cookie("www_search_history"));
        0 != e.length && ($(".js-new-related-search .lately-search .related-search-class").empty(),
        e.forEach(function(e) {
            e && 0 < e.myTrim().length && $(".js-new-related-search .lately-search .related-search-class").append('<a class="lately-wrod" data-text="' + e + '" data-type="' + $(".search-title>span.active").attr("data-id") + '">' + e + "</a>")
        }),
        $(".js-new-related-search .lately-search").show(),
        $(".js-new-related-search .lately-wrod").on("click", function() {
            N($(this).attr("data-text"), r || o(), 2, 1)
        }),
        $(".lately-search .icon_search_delete").on("click", function() {
            $.cookie("www_search_history", null, {
                expires: -1,
                path: "/",
                domain: "3d66.com"
            }),
            $(".js-new-related-search .lately-search").hide()
        }))
    } else
        $(".js-new-related-search .lately-search").hide();
    r != $(".js-new-search-box .search-title>span.active").attr("data-id") && t(r = $(".js-new-search-box .search-title>span.active").attr("data-id"))
})

//吸顶搜索框关闭
$(document).on("click", ".js-nav-search-close,.new-nav-search-mask", function() {
    $(".js-new-search-box").removeClass("active").find(".js-new-search-input").removeAttr("style"),
    $(".scroll-white head-fixed .nav-right").removeClass("search-active-right"),
    $(".new-nav-page .left-nav-list,.new-nav-page .right-nav-item").show(),
    $(".js-new-related-search").hide(),
    $(".autocomplete-suggestions").hide(),
    $(".js-nav-search").blur(),
    $(".new-nav-search-mask").fadeOut(),
    s = 0;
    var e = $('.js-new-search-box .search-title>span[data-id="' + o() + '"]');
    $(".js-new-search-input .select-class .select-class-txt").text(e.text().trim()),
    e.addClass("active").siblings().removeClass("active"),
    V($(this).parents(".js-new-search-box"), o())
})

// //轮播图切换
// new Swiper(".swiper-container-wwwbg",{
//     autoplay: !1,
//     loop: !0,
//     effect: "fade",
//     pagination: {
//         el: ".swiper-pagination",
//         clickable: !0
//     },
//     navigation: {
//         nextEl: ".banner_author_prev_page",
//         prevEl: ".banner_author_next_page"
//     }
// })
}